package com.xd.springaiagent.tools;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class WeatherTool {

    @Tool(name = "weatherQuery", description = "get the current weather")
    public String weatherQuery(
            @ToolParam(description = "query keyword", required = true) String query
    ) {
        try {
            return "天气是大晴天";
        } catch (Exception e) {
            return "{\"error\":\"Search failed: " + e.getMessage() + "\"}";
        }
    }
}
